<!DOCTYPE html>
<html>
<head><title>TUIO Client plugin test</title>
<style type="text/css">
body { margin: 0px; overflow: hidden; }
</style>
<script type="text/javascript" src="../lib/tuio.js"></script>
<script type="text/javascript" src="../lib/tuiojs.npTuioClient.js"></script>
<script type="text/javascript">

var canvas;
var ctx;
var w = 300;
var h = 300;

function updateCanvasSize() {
	var nw = window.innerWidth;
	var nh = window.innerHeight;

	if ((w != nw) || (h != nh)) {
		w = nw;
		h = nh;
		canvas.style.width = w+'px';
		canvas.style.height = h+'px';
		canvas.width = w;
		canvas.height = h;
	}
}

tuio.cursor_update(function(data) {
	var px = data.x * w;
	var py = data.y * h;

	ctx.beginPath();
	ctx.fillStyle = "rgba(0, 0, 200, 0.2)";
	ctx.arc(px, py, 15, 0, 2*Math.PI, true);
	ctx.fill();
});

function init() {
	canvas = document.getElementById('canvas');
	ctx = canvas.getContext('2d');
	tuio.start();
	updateCanvasSize();
}

</script>
</head>
<body onload="init()">
	
<canvas id="canvas" width="300" height="300" style="top:0px; left:0px; width: 300px; height: 300px;"></canvas>

</body>
</html>
